home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
mac
/
data
/
menu_dvd.swf
/
scripts
/
__Packages
/
mx
/
core
/
UIObject.as
< prev
Wrap
Text File
|
2007-11-07
|
15KB
|
600 lines
class mx.core.UIObject extends MovieClip
{
static var symbolName = "UIObject";
static var symbolOwner = mx.core.UIObject;
static var version = "2.0.2.126";
static var textColorList = {color:1,disabledColor:1};
var invalidateFlag = false;
var lineWidth = 1;
var lineColor = 0;
var tabEnabled = false;
var clipParameters = {visible:1,minHeight:1,minWidth:1,maxHeight:1,maxWidth:1,preferredHeight:1,preferredWidth:1};
function UIObject()
{
super();
this.constructObject();
}
function get width()
{
return this._width;
}
function get height()
{
return this._height;
}
function get left()
{
return this._x;
}
function get x()
{
return this._x;
}
function get top()
{
return this._y;
}
function get y()
{
return this._y;
}
function get right()
{
return this._parent.width - (this._x + this.__get__width());
}
function get bottom()
{
return this._parent.height - (this._y + this.__get__height());
}
function getMinHeight(Void)
{
return this._minHeight;
}
function setMinHeight(h)
{
this._minHeight = h;
}
function get minHeight()
{
return this.getMinHeight();
}
function set minHeight(h)
{
this.setMinHeight(h);
}
function getMinWidth(Void)
{
return this._minWidth;
}
function setMinWidth(w)
{
this._minWidth = w;
}
function get minWidth()
{
return this.getMinWidth();
}
function set minWidth(w)
{
this.setMinWidth(w);
}
function setVisible(x, noEvent)
{
if(x != this._visible)
{
this._visible = x;
if(noEvent != true)
{
this.dispatchEvent({type:(!x ? "hide" : "reveal")});
}
}
}
function get visible()
{
return this._visible;
}
function set visible(x)
{
this.setVisible(x,false);
}
function get scaleX()
{
return this._xscale;
}
function set scaleX(x)
{
this._xscale = x;
}
function get scaleY()
{
return this._yscale;
}
function set scaleY(y)
{
this._yscale = y;
}
function doLater(obj, fn)
{
if(this.methodTable == undefined)
{
this.methodTable = new Array();
}
this.methodTable.push({obj:obj,fn:fn});
this.onEnterFrame = this.doLaterDispatcher;
}
function doLaterDispatcher(Void)
{
delete this.onEnterFrame;
if(this.invalidateFlag)
{
this.redraw();
}
var __methodTable = this.methodTable;
this.methodTable = new Array();
if(__methodTable.length > 0)
{
var m;
while((m = __methodTable.shift()) != undefined)
{
m.obj[m.fn]();
}
}
}
function cancelAllDoLaters(Void)
{
delete this.onEnterFrame;
this.methodTable = new Array();
}
function invalidate(Void)
{
this.invalidateFlag = true;
this.onEnterFrame = this.doLaterDispatcher;
}
function invalidateStyle(Void)
{
this.invalidate();
}
function redraw(bAlways)
{
if(this.invalidateFlag || bAlways)
{
this.invalidateFlag = false;
var i;
for(i in this.tfList)
{
this.tfList[i].draw();
}
this.draw();
this.dispatchEvent({type:"draw"});
}
}
function draw(Void)
{
}
function move(x, y, noEvent)
{
var oldX = this._x;
var oldY = this._y;
this._x = x;
this._y = y;
if(noEvent != true)
{
this.dispatchEvent({type:"move",oldX:oldX,oldY:oldY});
}
}
function setSize(w, h, noEvent)
{
var oldWidth = this.__width;
var oldHeight = this.__height;
this.__width = w;
this.__height = h;
this.size();
if(noEvent != true)
{
this.dispatchEvent({type:"resize",oldWidth:oldWidth,oldHeight:oldHeight});
}
}
function size(Void)
{
this._width = this.__width;
this._height = this.__height;
}
function drawRect(x1, y1, x2, y2)
{
this.moveTo(x1,y1);
this.lineTo(x2,y1);
this.lineTo(x2,y2);
this.lineTo(x1,y2);
this.lineTo(x1,y1);
}
function createLabel(name, depth, text)
{
this.createTextField(name,depth,0,0,0,0);
var o = this[name];
o._color = mx.core.UIObject.textColorList;
o._visible = false;
o.__text = text;
if(this.tfList == undefined)
{
this.tfList = new Object();
}
this.tfList[name] = o;
o.invalidateStyle();
this.invalidate();
o.styleName = this;
return o;
}
function createObject(linkageName, id, depth, initobj)
{
return this.attachMovie(linkageName,id,depth,initobj);
}
function createClassObject(className, id, depth, initobj)
{
var bSubClass = className.symbolName == undefined;
if(bSubClass)
{
Object.registerClass(className.symbolOwner.symbolName,className);
}
var o = mx.core.UIObject(this.createObject(className.symbolOwner.symbolName,id,depth,initobj));
if(bSubClass)
{
Object.registerClass(className.symbolOwner.symbolName,className.symbolOwner);
}
return o;
}
function createEmptyObject(id, depth)
{
return this.createClassObject(mx.core.UIObject,id,depth);
}
function destroyObject(id)
{
var o = this[id];
if(o.getDepth() < 0)
{
var dt = this.buildDepthTable();
var i = this.findNextAvailableDepth(0,dt,"up");
var temp = i;
o.swapDepths(temp);
}
o.removeMovieClip();
delete this[id];
}
function getSkinIDName(tag)
{
return this.idNames[tag];
}
function setSkin(tag, linkageName, initObj)
{
if(_global.skinRegistry[linkageName] == undefined)
{
mx.skins.SkinElement.registerElement(linkageName,mx.skins.SkinElement);
}
return this.createObject(linkageName,this.getSkinIDName(tag),tag,initObj);
}
function createSkin(tag)
{
var id = this.getSkinIDName(tag);
this.createEmptyObject(id,tag);
return this[id];
}
function createChildren(Void)
{
}
function _createChildren(Void)
{
this.createChildren();
this.childrenCreated = true;
}
function constructObject(Void)
{
if(this._name == undefined)
{
return undefined;
}
this.init();
this._createChildren();
this.createAccessibilityImplementation();
this._endInit();
if(this.validateNow)
{
this.redraw(true);
}
else
{
this.invalidate();
}
}
function initFromClipParameters(Void)
{
var bFound = false;
var i;
for(i in this.clipParameters)
{
if(this.hasOwnProperty(i))
{
bFound = true;
this["def_" + i] = this[i];
delete this[i];
}
}
if(bFound)
{
for(i in this.clipParameters)
{
var v = this["def_" + i];
if(v != undefined)
{
this[i] = v;
}
}
}
}
function init(Void)
{
this.__width = this._width;
this.__height = this._height;
if(this.initProperties == undefined)
{
this.initFromClipParameters();
}
else
{
this.initProperties();
}
if(_global.cascadingStyles == true)
{
this.stylecache = new Object();
}
}
function getClassStyleDeclaration(Void)
{
var o = this;
var c = this.className;
while(c != undefined)
{
if(this.ignoreClassStyleDeclaration[c] == undefined)
{
if(_global.styles[c] != undefined)
{
return _global.styles[c];
}
}
o = o.__proto__;
c = o.className;
}
}
function setColor(color)
{
}
function __getTextFormat(tf, bAll)
{
var o = this.stylecache.tf;
if(o != undefined)
{
var j;
for(j in mx.styles.StyleManager.TextFormatStyleProps)
{
if(bAll || mx.styles.StyleManager.TextFormatStyleProps[j])
{
if(tf[j] == undefined)
{
tf[j] = o[j];
}
}
}
return false;
}
var bUndefined = false;
var j;
for(j in mx.styles.StyleManager.TextFormatStyleProps)
{
if(bAll || mx.styles.StyleManager.TextFormatStyleProps[j])
{
if(tf[j] == undefined)
{
var v = this._tf[j];
if(v != undefined)
{
tf[j] = v;
}
else if(j == "font" && this.fontFamily != undefined)
{
tf[j] = this.fontFamily;
}
else if(j == "size" && this.fontSize != undefined)
{
tf[j] = this.fontSize;
}
else if(j == "color" && this.color != undefined)
{
tf[j] = this.color;
}
else if(j == "leftMargin" && this.marginLeft != undefined)
{
tf[j] = this.marginLeft;
}
else if(j == "rightMargin" && this.marginRight != undefined)
{
tf[j] = this.marginRight;
}
else if(j == "italic" && this.fontStyle != undefined)
{
tf[j] = this.fontStyle == j;
}
else if(j == "bold" && this.fontWeight != undefined)
{
tf[j] = this.fontWeight == j;
}
else if(j == "align" && this.textAlign != undefined)
{
tf[j] = this.textAlign;
}
else if(j == "indent" && this.textIndent != undefined)
{
tf[j] = this.textIndent;
}
else if(j == "underline" && this.textDecoration != undefined)
{
tf[j] = this.textDecoration == j;
}
else if(j == "embedFonts" && this.embedFonts != undefined)
{
tf[j] = this.embedFonts;
}
else
{
bUndefined = true;
}
}
}
}
if(bUndefined)
{
var name = this.styleName;
if(name != undefined)
{
if(typeof name != "string")
{
bUndefined = name.__getTextFormat(tf,true,this);
}
else if(_global.styles[name] != undefined)
{
bUndefined = _global.styles[name].__getTextFormat(tf,true,this);
}
}
}
if(bUndefined)
{
var ss = this.getClassStyleDeclaration();
if(ss != undefined)
{
bUndefined = ss.__getTextFormat(tf,true,this);
}
}
if(bUndefined)
{
if(_global.cascadingStyles)
{
if(this._parent != undefined)
{
bUndefined = this._parent.__getTextFormat(tf,false);
}
}
}
if(bUndefined)
{
bUndefined = _global.style.__getTextFormat(tf,true,this);
}
return bUndefined;
}
function _getTextFormat(Void)
{
var tf = this.stylecache.tf;
if(tf != undefined)
{
return tf;
}
tf = new TextFormat();
this.__getTextFormat(tf,true);
this.stylecache.tf = tf;
if(this.enabled == false)
{
var c = this.getStyle("disabledColor");
tf.color = c;
}
return tf;
}
function getStyleName(Void)
{
var name = this.styleName;
if(name != undefined)
{
if(typeof name != "string")
{
return name.getStyleName();
}
return name;
}
if(this._parent != undefined)
{
return this._parent.getStyleName();
}
return undefined;
}
function getStyle(styleProp)
{
var v = undefined;
_global.getStyleCounter++;
if(this[styleProp] != undefined)
{
return this[styleProp];
}
var name = this.styleName;
if(name != undefined)
{
if(typeof name != "string")
{
v = name.getStyle(styleProp);
}
else
{
var ss = _global.styles[name];
v = ss.getStyle(styleProp);
}
}
if(v != undefined)
{
return v;
}
var ss = this.getClassStyleDeclaration();
if(ss != undefined)
{
v = ss[styleProp];
}
if(v != undefined)
{
return v;
}
if(_global.cascadingStyles)
{
if(mx.styles.StyleManager.isInheritingStyle(styleProp) || mx.styles.StyleManager.isColorStyle(styleProp))
{
var b = this.stylecache;
if(b != undefined)
{
if(b[styleProp] != undefined)
{
return b[styleProp];
}
}
if(this._parent != undefined)
{
v = this._parent.getStyle(styleProp);
}
else
{
v = _global.style[styleProp];
}
if(b != undefined)
{
b[styleProp] = v;
}
return v;
}
}
if(v == undefined)
{
v = _global.style[styleProp];
}
return v;
}
static function mergeClipParameters(o, p)
{
for(var i in p)
{
o[i] = p[i];
}
return true;
}
}